/*
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 */
using VOL.Core.BaseProvider;
using VOL.Entity.DomainModels;
using VOL.Core.Utilities;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace VOL.demo.IServices
{
    public partial interface IPurchaseOrderModelService : IService<PurchaseOrderModel>
    {
        /// <summary>
        /// 分页查询进货订单
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="orderCode">进货单号</param>
        /// <param name="status">单据状态</param>
        /// <param name="supplierId">供应商ID</param>
        /// <param name="orderDate">进货日期</param>
        /// <returns>分页结果</returns>
        Task<WebResponseContent> GetPurchaseOrderPageListAsync(
            int pageIndex, 
            int pageSize, 
            string orderCode = null, 
            int? status = null, 
            long? supplierId = null, 
            DateTime? orderDate = null);

        /// <summary>
        /// 保存进货订单
        /// </summary>
        /// <param name="request">进货订单保存请求</param>
        /// <returns>保存结果</returns>
        Task<WebResponseContent> SavePurchaseOrderAsync(SavePurchaseOrderRequest request);
    }

    /// <summary>
    /// 保存进货订单请求模型
    /// </summary>
    public class SavePurchaseOrderRequest
    {
        /// <summary>
        /// 进货订单主表信息
        /// </summary>
        public PurchaseOrderCreateDto PurchaseOrder { get; set; }

        /// <summary>
        /// 进货订单明细列表
        /// </summary>
        public List<PurchaseOrderItemCreateDto> OrderItems { get; set; }
    }

    /// <summary>
    /// 进货订单创建DTO（不包含自增ID）
    /// </summary>
    public class PurchaseOrderCreateDto
    {
        /// <summary>
        /// 进货单号(自动获取系统编号)
        /// </summary>
        public string OrderCode { get; set; }

        /// <summary>
        /// 进货日期
        /// </summary>
        public DateTime? OrderDate { get; set; }

        /// <summary>
        /// 供应商 ID
        /// </summary>
        public long? SupplierId { get; set; }

        /// <summary>
        /// 联系人
        /// </summary>
        public string Contact { get; set; }

        /// <summary>
        /// 联系方式
        /// </summary>
        public string ContactPhone { get; set; }

        /// <summary>
        /// 进货部门 ID
        /// </summary>
        public string DeptId { get; set; }

        /// <summary>
        /// 进货人 ID
        /// </summary>
        public int? UserId { get; set; }

        /// <summary>
        /// 单据状态(1.草稿、2.待审批....)
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remarks { get; set; }
    }

    /// <summary>
    /// 进货订单明细创建DTO（不包含自增ID）
    /// </summary>
    public class PurchaseOrderItemCreateDto
    {
        /// <summary>
        /// 货品ID
        /// </summary>
        public long GoodsId { get; set; }

        /// <summary>
        /// 货品数量
        /// </summary>
        public decimal Quantity { get; set; }

        /// <summary>
        /// 进货单价
        /// </summary>
        public decimal UnitPrice { get; set; }

        /// <summary>
        /// 金额
        /// </summary>
        public decimal Amount { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
    }
}
